using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MiniAnimation
{
    public static class TransformMiniExtension
    {
        public static MiniAnim MiniLocalMove(this Transform transform, Vector3 targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localPosition, (x) => { transform.localPosition = x; }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniLocalMoveX(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localPosition.x, (x) => { transform.localPosition = new Vector3(x, transform.localPosition.y, transform.localPosition.z); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniLocalMoveY(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localPosition.y, (x) => { transform.localPosition = new Vector3(transform.localPosition.x, x, transform.localPosition.z); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniLocalMoveZ(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localPosition.z, (x) => { transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, x); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniMove(this Transform transform, Vector3 targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.position, (x) => { transform.position = x; }, targetPosi, duration, curve);
        }

        public static MiniAnim MiniMoveX(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.position.x, (x) => { transform.position = new Vector3(x, transform.position.y, transform.position.z); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniMoveY(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.position.y, (x) => { transform.position = new Vector3(transform.position.x, x, transform.position.z); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniMoveZ(this Transform transform, float targetPosi, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.position.z, (x) => { transform.position = new Vector3(transform.position.x, transform.position.y, x); }, targetPosi, duration, curve);
        }
        public static MiniAnim MiniScale(this Transform transform, Vector3 targetScale, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localScale, (x) => { transform.localScale = x; }, targetScale, duration, curve);
        }
        public static MiniAnim MiniScale(this Transform transform, float targetScale, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localScale.x, (x) => { transform.localScale = new Vector3(x, x, x); }, targetScale, duration, curve);
        }
        public static MiniAnim MiniScaleX(this Transform transform, float targetScale, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localScale.x, (x) => { transform.localScale = new Vector3(x, transform.localScale.y, transform.localScale.z); }, targetScale, duration, curve);
        }
        public static MiniAnim MiniScaleY(this Transform transform, float targetScale, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localScale.y, (x) => { transform.localScale = new Vector3(transform.localScale.x, x, transform.localScale.z); }, targetScale, duration, curve);
        }
        public static MiniAnim MiniScaleZ(this Transform transform, float targetScale, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.localScale.z, (x) => { transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, x); }, targetScale, duration, curve);
        }
        public static MiniAnim MiniRotate(this Transform transform, Vector3 targetRotate, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => transform.eulerAngles, (x) => { transform.rotation = Quaternion.Euler(x); }, targetRotate, duration, curve);
        }
        public static MiniAnim MiniAncMove(this RectTransform rectTrans, Vector2 targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition, (x) => { rectTrans.anchoredPosition = x; }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMoveX(this RectTransform rectTrans, float targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition.x, (x) => { rectTrans.anchoredPosition = new Vector2(x, rectTrans.anchoredPosition.y); }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMoveY(this RectTransform rectTrans, float targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition.y, (x) => { rectTrans.anchoredPosition = new Vector2(rectTrans.anchoredPosition.x, x); }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMove3DX(this RectTransform rectTrans, float targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition3D.x, (x) => { rectTrans.anchoredPosition3D = new Vector3(x, rectTrans.anchoredPosition3D.y, rectTrans.anchoredPosition3D.z); }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMove3DY(this RectTransform rectTrans, float targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition3D.y, (x) => { rectTrans.anchoredPosition3D = new Vector3(rectTrans.anchoredPosition3D.x, x, rectTrans.anchoredPosition3D.z); }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMove3DZ(this RectTransform rectTrans, float targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition3D.z, (x) => { rectTrans.anchoredPosition3D = new Vector3(rectTrans.anchoredPosition3D.x, rectTrans.anchoredPosition3D.y, x); }, targetPosition, duration, curve);
        }
        public static MiniAnim MiniAncMove3D(this RectTransform rectTrans, Vector3 targetPosition, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => rectTrans.anchoredPosition3D, (x) => { rectTrans.anchoredPosition = x; }, targetPosition, duration, curve);
        }
    }
    public static class SpriteRendererMiniExtension
    {
        public static MiniAnim MiniColorTween(this SpriteRenderer spriteRenderer, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => spriteRenderer.color, (x) => { spriteRenderer.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this SpriteRenderer spriteRenderer, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => spriteRenderer.color.a, (x) => { spriteRenderer.color = new Color(spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, x); }, targetAlpha, duration, curve);
        }
    }
    public static class CanvasGroupMiniExtension
    {
        public static MiniAnim MiniFade(this CanvasGroup canvasGroup, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => canvasGroup.alpha, (x) => { canvasGroup.alpha = x; }, targetAlpha, duration, curve);
        }
    }
    public static class ImageMiniExtension
    {
        public static MiniAnim MiniColorTween(this UnityEngine.UI.Image image, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => image.color, (x) => { image.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this UnityEngine.UI.Image image, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => image.color.a, (x) => { image.color = new Color(image.color.r, image.color.g, image.color.b, x); }, targetAlpha, duration, curve);
        }
    }
    public static class TextMiniExtension
    {
        public static MiniAnim MiniColorTween(this UnityEngine.UI.Text text, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => text.color, (x) => { text.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this UnityEngine.UI.Text text, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => text.color.a, (x) => { text.color = new Color(text.color.r, text.color.g, text.color.b, x); }, targetAlpha, duration, curve);
        }
    }
    public static class MeshRendererMiniExtension
    {
        public static MiniAnim MiniColorTween(this MeshRenderer meshRenderer, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => meshRenderer.material.color, (x) => { meshRenderer.material.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this MeshRenderer meshRenderer, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => meshRenderer.material.color.a, (x) => { meshRenderer.material.color = new Color(meshRenderer.material.color.r, meshRenderer.material.color.g, meshRenderer.material.color.b, x); }, targetAlpha, duration, curve);
        }
    }
    public static class LightMiniExtension
    {
        public static MiniAnim MiniColorTween(this Light light, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => light.color, (x) => { light.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this Light light, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => light.color.a, (x) => { light.color = new Color(light.color.r, light.color.g, light.color.b, x); }, targetAlpha, duration, curve);
        }
    }
    public static class MaterialMiniExtension
    {
        public static MiniAnim MiniColorTween(this Material material, Color targetColor, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => material.color, (x) => { material.color = x; }, targetColor, duration, curve);
        }
        public static MiniAnim MiniFade(this Material material, float targetAlpha, float duration, MiniCurve curve = MiniCurve.None)
        {
            return MiniAnimate.MiniTo(() => material.color.a, (x) => { material.color = new Color(material.color.r, material.color.g, material.color.b, x); }, targetAlpha, duration, curve);
        }
    }



}